package com.example.observer.dubbo;

public interface Prioritized extends Comparable<Prioritized>{

    /**
     * The maximum priority
     */
    int MAX_PRIORITY = Integer.MIN_VALUE;

    /**
     * The minimum priority
     */
    int MIN_PRIORITY = Integer.MAX_VALUE;

    /**
     * Normal Priority
     */
    int NORMAL_PRIORITY = 0;

    /**
     * Get the priority
     *
     * @return the default is {@link #NORMAL_PRIORITY}
     */
    default int getPriority() {
        return NORMAL_PRIORITY;
    }


    @Override
    default int compareTo(Prioritized other) {
        return Integer.compare(getPriority(),other.getPriority());
    }
}
